package cn.juque.simplefactory.factory;

import cn.juque.common.exception.AppException;
import cn.juque.simplefactory.entity.ModelThree;
import cn.juque.simplefactory.entity.ModelY;
import cn.juque.simplefactory.product.Tesla;
import org.aspectj.bridge.AbortException;

/**
 * @author juque
 * @version 1.0.0
 * <ul>
 *     <li>SuperFactory</li>
 * </ul>
 * @date 2023-06-04 23:38:04
 **/
public class SuperFactory {

    public static final String MODEL_3 = "model3";

    public static final String MODEL_Y = "modelY";

    private SuperFactory() {
    }

    public static Tesla createCar(String name) {
        if(MODEL_3.equals(name)) {
            return new ModelThree(MODEL_3);
        }
        if(MODEL_Y.equals(name)) {
            return new ModelY(MODEL_Y);
        }
        throw new AppException("create car error");
    }
}
